<%@ page import="cn.kgc.day02.entity.Student" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.TreeMap" %>
<%@ page import="java.net.http.HttpRequest" %><%--
  Created by IntelliJ IDEA.
  User: mengshun
  Date: 2024/10/9
  Time: 14:55
  To change this template use File | Settings | File Templates.

  jsp的注释
  <%@ page %>
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--  引入jstl标签库--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <title>Title</title>
    <style>
        table,tr,th,td{
            border: 2px  solid red;
            border-collapse: collapse;
        }
    </style>
</head>
<body>
<%--
    jsp 九大内置对象   不用创建new  就能直接使用的对象
    四大域对象  数据的保存和传递
    request
--%>
<%
    Student student = new Student();
    student.setName("lisi");
    student.setId(1);
    student.setAge(20);
    List<Student> students = Arrays.asList(student, student, student);
    request.setAttribute("students",students);
%>

<table>
    <tr>
        <th>ID</th>
        <th>姓名</th>
        <th>年龄</th>
    </tr>
<%--  jstl   el表达式 ${} 作用   从域对象中取值   --%>
    <c:forEach items="${students}" var="stu">
        <tr>
            <td>${stu.id}</td>
            <td>${stu.name}</td>
            <td>${stu.age}</td>
        </tr>
    </c:forEach>
</table>

</body>
</html>
